$dir="/data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/Matrix_eQTL_R_Source/results_permutation";
$dir1="/data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/Matrix_eQTL_R_Source/results_permutation_sorted";
$ls = `ls $dir`;
@a1 = split("\n",$ls);
$j =0;
for($i=0;$i<@a1;$i++)
{
	if($a1[$i] !~ m/order/)
	{
		$a[$j] = $a1[$i];	
		$j++;
	}	
}
for($i=0;$i<@a;$i++)
{
	$sys = "Rscript sort_script.R $dir/$a[$i] $dir1/$a[$i]";
	print $sys."\n";
	system($sys);
	#system("Rscript sort_script.R ./results_permutation/$a[$i] ./results_permutation_sorted/$a[$i]");
}
